package com.chang.tools;

import java.net.URL;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;

public class Tools {
    public String File_Path;
    public Tools(){
        Class<?> currentClass = Tools.class;
        URL res = currentClass.getProtectionDomain().getCodeSource().getLocation();
        String dPath = URLDecoder.decode(res.getFile(), StandardCharsets.UTF_8);
        java.io.File sPath = new java.io.File(dPath).getParentFile().getParentFile().getParentFile();
        File_Path = sPath.toString() + "\\项目源码\\CashSystem";
    }
    public static void clearScreen() {
        try {
            String os = System.getProperty("os.name");
            if (os.contains("Windows")) {
                new ProcessBuilder("cmd", "/c", "cls").inheritIO().start().waitFor();
            } else {
                Runtime.getRuntime().exec("clear");
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
